<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>

    <div id="app">
        <p>过滤前的时间：{{ time }}</p>
        <p>{{ time | datefmt}}</p>
    </div>


    <script src="../JS/vue.js"></script>
    <script>
        new Vue({
            el: '#app',
            data() {
                return {
                    time: new Date()
                }
            },
            filters: {
                datefmt(time) {
                    let newTime = ''
                    let year = time.getFullYear()
                    let month = time.getMonth()
                    let day = time.getDate()
                    return '过滤后的时间：' + year +'年'+ month +'月'+ day +'日'
                }
            }
        })
    </script>
</body>

</html>